<template>
    <div class="goods-card y-flex" @click="toDetail">
        <div>
            <img :src="img" class="goods-card-bg">
            <div class="goods-info">
                <div class="goods-info__top y-center__between">
                    <span>{{ shopInfo.name }}</span>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name: 'ShopCard',
    props: {
        shopInfo: {
            type: Object,
            default: () => {}
        }
    },
    data() {
        return {
            img: 'https://coding.imooc.com/static/module/class/content/img/144/section0-6.png'
        }
    },
    computed: {
        
    },
    methods: {
        toDetail() {
            this.$router.push({
                path: '/shopDetail',
                query: {
                    shopInfo: this.shopInfo
                }
            })
        }
    }
}
</script>

<style scoped>
    .goods-card {
        box-sizing: border-box;
        width: 176px;
        height: 223px;
        padding: 10px;
        margin-top: 10px;
        background: #fff;
        border-radius: 5px;
    }
      .goods-card-bg {
            width: 158px;
            height: 158px;
            border-radius: 5px;
            object-fit: cover;
        }

        .goods-info {
            margin-top: 10px;
            color: #333;
        }
          .goods-info__top {
                font-size: 16px;
                font-weight: bold;
            }

            .goods-info__bottom {
                margin-top: 10px;

                
            }
            .sales {
                    font-size: 12px;
                    color: #999;
                }
</style>
